@extends('Admin.Layout.main')
@section('privateheader')
    <!-- DataTables -->
    <link rel="stylesheet" href="{{__BASE__}}/admin/plugins/datatables/dataTables.bootstrap.css">
    <link rel="stylesheet" href="{{__BASE__}}/admin/plugins/treetable/css/jquery.treeTable.css">
@endsection
@section('content')
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        @if($data['flag'] == 3)
                            <h3 class="box-title">权限节点管理</h3>
                            <a class="btn bg-olive" href="{{__BASE__}}admini/adminusernode/create">权限节点添加</a>
                            <a class="btn bg-red" href="{{__BASE__}}admini/adminusernode/rb">回收站</a>
                        @elseif($data['flag'] == 4)
                            <h3 class="box-title">用户组管理回收站</h3>
                            <a class="btn bg-olive" href="{{__BASE__}}admini/adminusernode">用户组管理</a>
                        @endif
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table class="table table-bordered table-striped" id="treeTable2">
                            <thead>
                            <tr>
                                <th>权限节点名称</th>
                                <th>权限ID</th>
                                <th>权限节点标识</th>
                                <th>父级权限节点</th>
                                <th>权限节点描述</th>
                                <th>左侧导航是否显示</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if(!empty($data['list']))
                                @foreach($data['list'] as $v)
                                    <tr id="{{$v['id']}}" <?php echo $v['pid'] != '' ? 'pId="'.$v['pid'].'"' : '';?> >
                                        <td>&nbsp;&nbsp;{{$v['name']}}</td>
                                        <td>{{$v['id'] or ''}}</td>
                                        <td>{{$v['node_name'] or ''}}</td>
                                        <td>{{$v['pidname'] or '顶级'}}</td>
                                        <td>{{$v['summary'] or ''}}</td>
                                        <td><?php echo key_exists('is_show',$v) && $v['is_show'] == 1? '是': '否';?></td>
                                        <td>
                                            @if($data['flag'] == 3)
                                                <button class="btn bg-olive" type="button" onclick="javascript:location.href='/admini/adminusernode/create?pid={{$v['id'] or 0}}'">添加</button>
                                                <button class="btn bg-orange" type="button" onclick="javascript:location.href='/admini/adminusernode/{{$v['id'] or ''}}/edit'">修改</button>
                                                <button class="btn bg-red delbutton" type="button" delurl="/admini/adminusernode/{{$v['id'] or ''}}" skipurl="/admini/adminusernode" ac="1">删除</button>
                                            @elseif($data['flag'] == 4)
                                                <button class="btn bg-orange delbutton" type="button" delurl="/admini/adminusernode/{{$v['id'] or ''}}" skipurl="/admini/adminusernode" ac="3">还原</button>
                                                <button class="btn bg-red delbutton" type="button" delurl="/admini/adminusernode/{{$v['id'] or ''}}" skipurl="/admini/adminusernode" ac="2">删除</button>
                                            @endif
                                        </td>
                                    </tr>
                                @endforeach
                            @endif
                            </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
@endsection
@section('privatefooter')
    <script src="{{__BASE__}}/admin/plugins/treetable/js/jquery.treeTable.js" type="text/javascript"></script>
    <!-- /.content -->
    <script type="text/javascript">
        $(function(){
            @if($data['flag'] != 4)
                var option = {
                            theme:'vsStyle',
                            expandLevel : 2
                        };
                option.theme = 'default';
                $('#treeTable2').treeTable(option);
            @endif
        });
    </script>
@endsection